
#include "UsbAdapter.h"
#include "Ps2.h"
#include <iostream>

using namespace npAdapter;
using namespace std;


UsbAdapter::UsbAdapter() // class inheritance
{
    //To initialize data member;
    this->ps2 = new Ps2();
}

UsbAdapter::~UsbAdapter()
{
    //To delete dynamic data member
    delete this->ps2;
}

UsbAdapter::UsbAdapter(const UsbAdapter& cpy) // class inheritance
{
    //To copy data member
    this->ps2 = cpy.ps2->clone();
}

UsbAdapter& UsbAdapter::operator=(const UsbAdapter& asn)
{
    if (this == &asn)
    {
        return *this;
    }
    else
    {
        //To invoke base class operator=
        
        //To assign data member, note to delete dynamic member if exists.
        delete this->ps2;
        this->ps2 = asn.ps2->clone();
        return *this;
    }
}

UsbAdapter* UsbAdapter::clone() const
{
    return new UsbAdapter(*this);
}

//other constructors

//public methods
void UsbAdapter::transferData()
{
    cout << "using usb adapter, " << endl;
    this->ps2->transferData();
}

//protected methods
